<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/jeecms_sys/head.html"/>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
	//processButton();
});
</script>
<style type="text/css">
.items{padding-top:1px;}
</style>
</head>
<body>

<div class="body-box">
<@p.form id="jvForm" action="o_updateProductSpecification.do">
<div>
	<div class="items"><input type="button" class="add_subTopic"
	 value="增加规格" onclick="addproductSku();"/></div>
	<#list specifications as spec>
		<div class="items" id="productSku${spec_index}">
		规格: <input type="text" id="skuCode${spec_index}" name="specifications" value="${spec.specification!}" style="width:50px"/>
		&nbsp; 销售价格: <input type="text" id="price${spec_index}" name="prices" value="${spec.price!}" style="width:80px"/>
		&nbsp; 库存数量: <input type="text" id="storeNum${spec_index}" name="counts" value="${spec.count!}" style="width:80px"/>
		&nbsp; <input class="del-button" type="button"  value="<@s.m "global.delete"/>" onclick="$(this).parent().remove();"/>
		</div>
	</#list>
	<div id="productSkuContainer"></div>
    <input name="productId" value="${product.id}" type="hidden"/>
</div>
<@p.tr/>
<@p.td><@p.submit code="global.submit"/> </@p.td>
</@p.form>
</div>

<textarea id="subTopicTpl" style="display:none;">
<div class="items">
规格: <input type="text" name="specifications" value="0" style="width:50px"/>
&nbsp; 销售价格: <input type="text"  name="prices" value="0" style="width:80px"/>
&nbsp; 库存数量: <input type="text"  name="counts" value="0" style="width:80px"/>
&nbsp; <input class="del-button" type="button" value="<@s.m "global.delete"/>" onclick="$(this).parent().remove();"/>
</div>
</textarea>
<script type="text/javascript">
var subtpl = $.format($("#subTopicTpl").val());
var subindex = ${specifications?size}+1;
var num = 10;
function addproductSku() {
	$("#productSkuContainer").append(subtpl(subindex+""+(num++)));
//	$("#productSkuContainer").append(subtpl(skuCodeMax++));
}
</script>
<#include "/common/alert_message.html"/>
</body>
</html>